Build a temporal value from entity instances

Build a temporal value from entity instances

You can convert entities into temporal attributes using the Temporal From Start Date, Temporal From End Date, and Temporal From Range functions. The entities contain a value attribute and either a start date, an end date, or both. The functions also take a default value that is applied to any uncovered periods. The default value must be a constant or expression of the same type as the value attribute, or uncertain or unknown.

What do you want to do?

Get a temporal attribute from entity instances with values from the start date

Get a temporal attribute from entity instances with values up until the end date

Get a temporal attribute from entity instances with values from the start date until the end date

Get a temporal attribute from entity instances with values from the start date

The Temporal From Start Date function takes a relationship, a start date attribute on the entities in the relationship, and a value attribute on the entities, and returns a single temporal attribute (at the source entity level) with values that take effect from the start date. Care should be taken that the start dates are unique, because the result will be 'uncertain' if two entities have the same start date.

 

The syntax for this function is:

 

For example, if a person has various jobs over the years, you could use the Temporal From Start Date function to determine the person's employer at a given time. To do this you would write the following rule in Word:

the person's most recent employer = TemporalFromStartDate(the person's jobs, the job's start date, the job's employer)

 

(For this rule to compile the following entities and relationship must be included in a properties files in the project: an entity 'the person' , an entity 'the job' and a one-to-many relationship 'the person's jobs'.)

 

If this rule is applied to the sample data below, 'the person's most recent employer' would take the following temporal result: {uncertain, Big Bank from 12/05/1995, Superannuation Company from 24/12/2002, Insurance Agency from 03/10/2007}.

 

employer start date
Big Bank 12/05/1995
Superannuation Company 24/12/2002
Insurance Agency 03/10/2007

Get a temporal attribute from entity instances with values up until the end date

The Temporal From End Date function takes a relationship, an end date attribute on the entities in the relationship, and a value attribute on the entities, and returns a single temporal attribute (at the source entity level) with values that take effect up until the end date.

NOTE:

 

The syntax for this function is:

Example 1: All end dates are specified

A person has a first aid certificate that must be renewed every year. Each certificate has an ID number that has been recorded with its expiry date. The Temporal From End Date function is used to determine the ID number that was current at any time. In Word you would write this rule as:

the person's effective first aid certificate ID = TemporalFromEndDate(the person's first aid certificates, the first aid certificate's expiry date, the first aid certificate ID)

 

(For this rule to compile the following entities and relationship must be included in a properties files in the project: an entity 'the person' , an entity 'the first aid certificate' and a one-to-many relationship 'the person's first aid certificates'.)

 

If this rule is applied to the sample data below, 'the person's effective first aid certificate ID' would take the following temporal result: {4534545A, 4943234E from 15/08/2005, 3404329F from 20/08/2006, uncertain from 12/08/2007}.

 

certificate ID expiry date
4534545A 15/08/2005
4943234E 20/08/2006
3404329F 12/08/2007

Example 2: One end date is open

In this example, one of the certificates has an open-ended expiry date.

 

certificate ID expiry date
4534545A 15/08/2005
4943234E 20/08/2006
3404329F uncertain

 

The intention is that this record remains in effect until further notice. When the data is collected, the expiry date for this record remains unanswered so it is initially uncertain. A rule table is required to convert the uncertain date to the latest possible date:

 

the first aid certificate's expiry date allowing for open ended entries
the first aid certificate's expiry date the first aid certificate's expiry date is certain
latest() otherwise

 

The original rule then uses the expiry date allowing for open ended entries:

the person's effective first aid certificate ID = TemporalFromEndDate(the person's first aid certificates, the first aid certificate's expiry date allowing for open ended entries, the first aid certificate ID)

 

The result is that 'the person's effective first aid certificate ID' is {4534545A, 4943234E from 15/08/2005, 3404329F from 20/08/2006}.

Example 3: Two end dates are equal (an error)

In this example, an error has been made resulting in two end dates that are equal:

 

certificate ID expiry date
4534545A 15/08/2005
9984993B 20/08/2006
4943234E 20/08/2006
3404329F 12/08/2007

 

Using the same rules as in the previous example, the result is that 'the person's effective first aid certificate ID' is {4534545A, uncertain from 15/08/2005, 3404329F from 20/08/2006, uncertain from 12/08/2007}.

Get a temporal attribute from entity instances with values from the start date until the end date

The Temporal From Range function takes a relationship, an effective start date attribute and an expiry date on the entities in the relationship, and a value attribute on the entities, and returns a single temporal attribute (at the source entity level) with values that takes effect from the start date (inclusive) until the end date (exclusive). The value is uncertain if it expires before the next start date. Care should be taken that the start dates are unique, because the result will be 'uncertain' for a while, if two entities have the same start dates.

 

The syntax for this function is:

 

For example, if a person working for the Government has a certain level of security clearance (valid for a specified period), you could use the Temporal From Range function to determine the person's security clearance at a point in time. To do this you would write the following rule in Word:

the person's effective security clearance = TemporalFromRange(the person's security clearances, the security clearance's start date, the security clearance's expiry date, the security clearance)

 

(For this rule to compile the following entities and relationship must be included in a properties files in the project: an entity 'the person' , an entity 'the security clearance' and a one-to-many relationship 'the person's security clearances'.)

 

If this rule is applied to the sample data below, the result is that 'the person's effective security clearance' is {uncertain, Low from 01/07/2005, Medium from 01/07/2006, High from 01/07/2007, uncertain from 01/07/2008}.

 

Security Clearance Start Date Expiry Date
Low 01/07/2005 30/06/2006
Medium 01/07/2006 30/06/2007
High 01/07/2007 30/06/2008

 

In reality, a security clearance may be open-ended, and security clearances may overlap. For example:

 

Security Clearance Start Date Expiry Date
Low 12/01/2004 uncertain
Medium 01/08/2006 20/08/2006
High 15/08/2006 20/08/2006

 

If more than one security clearance is valid at a particular time, the one with the most recent start date applies, as seen with this example:

 

 

When this data is collected, the expiry date for the open-ended record remains unanswered, so it is initially uncertain. A rule table is required to convert the uncertain date to the latest possible date:

 

the security clearance's expiry date allowing for open ended clearances
the security clearance's expiry date the security clearance's expiry date is certain
latest() otherwise

 

The original rule then uses the expiry date allowing for open ended entries:

the person's effective security clearance = TemporalFromRange(the person's security clearances, the security clearance's start date, the security clearance's expiry date allowing for open ended clearances, the security clearance)

 

The result is that 'the person's effective security clearance' is {uncertain, Low from 12/01/2004, Medium from 01/08/2006, High from 15/08/2006, Low from 20/8/2006}.

TIP: To see an example of a complete rulebase using this function, open and run the Aged Care Approval rulebase project provided in the Examples folder in the Oracle Policy Modeling installation folder.